<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductRepliesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_replies', function (Blueprint $table) {
            $table->id()->comment('评论表');
            $table->integer('user_id')->index()->comment('用户id');
            $table->integer('order_id')->index()->comment('订单id');
            $table->string('unique')->index()->comment('唯一id');
            $table->integer('product_id')->index()->comment('商品id');
            $table->string('nickname')->comment('用户昵称');
            $table->string('avatar')->comment('用户头像');
            $table->decimal('product_score',8,2)->comment('商品分数');
            $table->decimal('service_score',8,2)->comment('服务分数');
            $table->string('comment')->comment('评论内容');
            $table->json('pics')->nullable()->comment('评论图片');
            $table->string('merchant_reply_content')->nullable()->comment('管理员回复内容');
            $table->timestamp('merchant_reply_time')->nullable()->comment('管理员回复时间');
            $table->tinyInteger('is_reply')->index()->default(0)->comment('0未回复1已回复');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_replies');
    }
}
